//
//  NewsListViewController.swift
//  HeadlineNews
//
//  Created by han on 2019/6/20.
//  Copyright © 2019 han. All rights reserved.
//

import UIKit
import TangramKit

class NewsListViewController: BaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "NewsList"
        view.backgroundColor = UIColor.brown
        let button = UIButton(type: .system)
        button.setTitle("dismiss", for: .normal)
        button.frame = CGRect(x: 50, y: 100, width: 80, height: 80)
        view.addSubview(button)
        button.addTarget(self, action: #selector(didClick), for: .touchUpInside)
        self.hideNavigationBarIfNeeded = false
        self.popGestureEnable = true
    }
    
    @objc func didClick() {
        self.dismiss(animated: true, completion: nil)
//        let storyboard = UIStoryboard(storyboard: .Home)
//        let home: HomeViewController = storyboard.instantiateViewController()
//        home.transitionType = .push(.scale)
//        self.navigationController?.pushViewController(home, animated: true)
        
        let detail = NewsDetailViewController()
        self.navigationController?.pushViewController(detail, animated: true)
        
//        let list =  NewsListViewController()
//        list.transitionType = .present(.scale)
//        list.presentDelegate?.isDismissGestureEnabled(isEnabled: true)
//        self.present(list, animated: true, completion: nil)
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        FPSMonitor.shareInstance.startMonitor()
        
        
    }
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        FPSMonitor.shareInstance.stopMonitor()
    }
    
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        
    }
}


